package grame

/**
 * @author Shining Wang <shiningwang@topca.com>
 */
@SuppressWarnings("GroovyUnusedDeclaration")
class Role {
    String id = UUID.randomUUID().toString()
    String name
    Date dateCreated
    Date lastUpdated

    static hasMany = [users: User, permissions: String]
    static belongsTo = User

    static constraints = {
        id shared: 'id', bindable: true
        name shared: 'name', nullable: false, blank: false, unique: true
    }

    @Override
    public String toString() {
        return "${domainClass.name} : ${name}(${id})"
    }

}
